package org.wpchina.lawexam;

import org.wpchina.lawexam.R;
import org.wpchina.lawexam.datainfo.DeviceInfo;
import org.wpchina.lawexam.main.MainActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.DisplayMetrics;
import android.util.Log;

public class LoginActivity extends Activity {
	static final String TAG = "LawExamActivity";

	private Handler myHandler = null;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login_system);
        					
		myHandler = new Handler(){
			@Override
			public void handleMessage(Message msg) {
				// TODO Auto-generated method stub
				super.handleMessage(msg);
				
				Intent intent = new Intent(LoginActivity.this,MainActivity.class);
				intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				startActivity(intent);		
			}
		};
			
		new Thread(new Runnable(){

			@Override
			public void run() {
				// TODO Auto-generated method stub
				try{
					Thread.sleep(2*1000);
				}catch(InterruptedException e){
					e.printStackTrace();
				}
				myHandler.sendMessage(myHandler.obtainMessage());
			}			
		}).start();
		
	    DisplayMetrics localDisplayMetrics = new DisplayMetrics();
	    getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
	    DeviceInfo localInfoInstance1 = DeviceInfo.getInstance();
	    int i = localDisplayMetrics.widthPixels;
	    localInfoInstance1.widthPixels = i;
	    DeviceInfo localInfoInstance2 = DeviceInfo.getInstance();
	    int j = localDisplayMetrics.heightPixels;
	    localInfoInstance2.heightPixels = j;		
	    
	    Log.v(TAG,"width="+ i +"height=" +j);
    }	
}
